Import the required libraries


In [59]:
import pandas as pd
import numpy as np
from datetime import datetime
from faker import Factory
import csv

fake = Factory.create()

Use the faker library to create a csv of fake data


In [ ]:
with open('fake_dataset.csv', 'w',  newline='') as csvfile:
    writer = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
    writer.writerow(["first_name","last_name","ssn","date_of_birth","street_address","city","state","postcode","company","job","work_phone","work_street_address","work_city","work_state","work_postcode"])
    for i in range(0,10000):
        writer.writerow([fake.first_name(), 
                         fake.last_name(), 
                         fake.ssn(), 
                         fake.date_time_between(start_date="-70y", end_date="-25y").date(),
                         fake.street_address(),
                         fake.city(),
                         fake.state(),
                         fake.postcode(),
                         fake.company(),
                         fake.job(),
                         fake.phone_number(),
                         fake.street_address(),
                         fake.city(),
                         fake.state(),
                         fake.postcode()])
print("CSV created")

In [ ]: